package com.taxi.driver.module.order.popup;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;

import com.taxi.driver.R;
import com.taxi.driver.common.BaseActivity;

/**
 * 功能描述：订单弹窗
 */
public class OrderPopupActivity extends BaseActivity {

    public static final String KEY_ORDER_UUID = "ORDER_UUID";
    public static final String KEY_ASSIGN = "ASSIGN";

    OrderPopupFragment mFragment;

    public static void start(Context context, String orderUuid, boolean isAssign) {
        Intent starter = new Intent(context, OrderPopupActivity.class);
        starter.putExtra(KEY_ORDER_UUID, orderUuid);
        starter.putExtra(KEY_ASSIGN, isAssign);
        context.startActivity(starter);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_order_popup);
        String orderUuid = getIntent().getStringExtra(KEY_ORDER_UUID);
        boolean isRessign = getIntent().getBooleanExtra(KEY_ASSIGN, false);
        if (mFragment == null)
            addFragment(R.id.fragment_container, OrderPopupFragment.newInstance(orderUuid, isRessign));
    }

    @Override
    public void onAttachFragment(Fragment fragment) {
        super.onAttachFragment(fragment);
        if (fragment instanceof OrderPopupFragment) {
            mFragment = (OrderPopupFragment) fragment;
        }
    }
}